#include "Common.h"
#include "PhysicsCommon.h"
#include "PhysicsBody.h"
#include "PhysicsSystem.h"
#include "CollisionSkin.h"

using namespace Physics;

Body::Body()
	: mSkin(NULL)
	, mBodyEnabled(false)
	, mActived(false)
	, mImmovable(true)
{
}

Body::~Body()
{
	if (mSkin)
		mSkin->setOwner(NULL);

	DisableBody();
}

void Body::EnableBody()
{
	if (mBodyEnabled) 
		return;
  
	mBodyEnabled = true;
	System::Instance().AddBody(this);
}

void Body::DisableBody()
{
	if (!mBodyEnabled) 
		return;
	
	mBodyEnabled = false;
	System::Instance().RemoveBody(this);
}
